#include <string.h>
#include <iostream>

using std::cout;
using std::endl;

class Computer 
{
public:
    inline
    void setBrand(const char *brand);
    inline
    void setPrice(float price);
    inline
    void print();

private:
    char _brand[20];//品牌,brand_,m_nBrand
    float _price;//价格
};

inline
void Computer::setBrand(const char *brand)
{
    strcpy(_brand, brand);
}

inline
void Computer::setPrice(float price)
{
    _price = price;
}

inline
void Computer::print()
{
    cout << "_brand = " << _brand << endl
         << "_price = " << _price << endl;
}

int main(int argc, char **argv)
{
    int a;
    //使用类Computer创建对象com
    Computer com;
    com.setBrand("ThinkPad");
    com.setPrice(5300);
    com.print();

    /* com._price = 6000;//error,使用private封装性 */

    return 0;
}

